#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int n, m, arr[128][32];
    int i, j, temp;
    float nmax;
    cin >> n >> m;
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            cin >> arr[i][j];
        }
        sort(arr[i], arr[i] + m);
    }

    nmax = 0;
    for (i = 0; i < n; i++)
    {
        temp = 0;
        for (j = 1; j < m - 1; j++)
        {
            temp += arr[i][j];
        }
        if (m - 2 != 0)
        {
            nmax = max(nmax, (float)temp / (m - 2));
        }
    }

    printf("%.2lf", nmax);
    
    return 0;
}
